home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / unixcpio.gz / unixnet.cpio / icmp.h < prev    next >
C/C++ Source or Header  |  1994-07-11  |  2KB  |  66 lines

  1. /* Internet Control Message Protocol */
  2.  
  3. /* Message types */
  4. #define    ECHO_REPLY    0    /* Echo Reply */
  5. #define    DEST_UNREACH    3    /* Destination Unreachable */
  6. #define    QUENCH        4    /* Source Quench */
  7. #define    REDIRECT    5    /* Redirect */
  8. #define    ECHO        8    /* Echo Request */
  9. #define    TIME_EXCEED    11    /* Time-to-live Exceeded */
  10. #define    PARAM_PROB    12    /* Parameter Problem */
  11. #define    TIMESTAMP    13    /* Timestamp */
  12. #define    TIME_REPLY    14    /* Timestamp Reply */
  13. #define    INFO_RQST    15    /* Information Request */
  14. #define    INFO_REPLY    16    /* Information Reply */
  15.  
  16. /* Internal format of an ICMP header (checksum is missing) */
  17. struct icmp {
  18.     char type;
  19.     char code;
  20.      union icmp_args {
  21.         int32 unused;
  22.         unsigned char pointer;
  23.         int32 address;
  24.         struct {
  25.             int16 id;
  26.             int16 seq;
  27.         } echo;
  28.     } args;
  29. };
  30. #define    ICMPLEN        8    /* Length of ICMP header on the net */
  31. #define    NULLICMP    (union icmp_args *)0
  32.     
  33. /* Destination Unreachable codes */
  34. #define    NET_UNREACH    0    /* Net unreachable */
  35. #define    HOST_UNREACH    1    /* Host unreachable */
  36. #define    PROT_UNREACH    2    /* Protocol unreachable */
  37. #define    PORT_UNREACH    3    /* Port unreachable */
  38. #define    FRAG_NEEDED    4    /* Fragmentation needed and DF set */
  39. #define    ROUTE_FAIL    5    /* Source route failed */
  40.  
  41. /* Time Exceeded codes */
  42. #define    TTL_EXCEED    0    /* Time-to-live exceeded */
  43. #define    FRAG_EXCEED    1    /* Fragment reassembly time exceeded */
  44.  
  45. /* Redirect message codes */
  46. #define    REDR_NET    0    /* Redirect for the network */
  47. #define    REDR_HOST    1    /* Redirect for the host */
  48. #define    REDR_TOS    2    /* Redirect for Type of Service, or-ed with prev */
  49.  
  50. struct icmp_errors {
  51.     unsigned checksum;        /* ICMP Checksum errors */
  52.     unsigned nospace;        /* alloc_mbuf failed someplace */
  53.     unsigned noloop;        /* No ICMP in response to an ICMP */
  54.     unsigned bdcsts;        /* Ignore broadcast ICMPs */
  55. };
  56. #define    ICMP_TYPES    17
  57. struct icmp_stats {
  58.     unsigned input[ICMP_TYPES];    /* ICMP input stats by type */
  59.     unsigned output[ICMP_TYPES];    /* ICMP output stats by type */
  60. };
  61.  
  62. void icmp_dump();
  63.  
  64. /* ICMP messages, decoded */
  65. extern char *icmptypes[],*unreach[],*exceed[],*redirect[];
  66.